package com.baseweb.webadmin.core.constants;

import java.util.ArrayList;
import java.util.List;

/**
 * @description: 栏目位置类型枚举
 * @author: xiaoqiang
 */
public enum ChannelPositionType {
    LEFT(1,"左边栏目"),TOP(2,"顶部栏目"),BUTTOM(3,"底部栏目");
    private int code;
    private String name;
    ChannelPositionType(int code, String name){
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static List<ChannelPositionType> getAllData(){
        List<ChannelPositionType> result = new ArrayList<ChannelPositionType>();
        for (ChannelPositionType current : ChannelPositionType.values())
        {
            result.add(current);
        }
        return result;
    }

    public static ChannelPositionType getNameByCode(int code){
        List<ChannelPositionType> allData = getAllData();
        for (ChannelPositionType status : allData){
            if (status.getCode() == code){
                return status;
            }
        }
        return null;
    }
    public static List<String> getTypeOpt(){
        List<String> list = new ArrayList<>();
        for (ChannelPositionType current : ChannelPositionType.values())
        {
            String string = current.getCode() +";"+ current.getName();
            list.add(string);
        }
        return list;
    }
}
